using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using Domain.Entidades;
using System.ComponentModel.DataAnnotations.Schema;

namespace Data.Models.Mapping
{
    public class VW_solicitacoes_impressorasMap : EntityTypeConfiguration<VW_solicitacoes_impressoras>
    {
        public VW_solicitacoes_impressorasMap()
        {
            // Primary Key
            this.HasKey(t => new { t.imp_codigo, t.tip_codigo, t.sol_codigo, t.imp_descricao, t.sol_data, t.sol_horario, t.usu_codigo, t.uni_codigo, t.uni_descricao,
                t.car_descricao, t.set_codigo, t.set_descricao, t.imp_numero_serie, t.sol_descricao });

            // Properties
            this.Property(t => t.imp_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.tip_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.sol_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.tip_descricao)
                .HasMaxLength(150);

            this.Property(t => t.imp_descricao)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.sol_horario)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.usu_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.usu_nome)
                .HasMaxLength(100);

            this.Property(t => t.usu_login)
                .HasMaxLength(100);

            this.Property(t => t.uni_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.uni_descricao)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.car_descricao)
                .IsRequired()
                .HasMaxLength(153);

            this.Property(t => t.set_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.set_descricao)
                .IsRequired()
                .HasMaxLength(50);


            this.Property(t => t.imp_numero_serie)
                .IsRequired()
                .HasMaxLength(50);


            this.Property(t => t.sol_descricao)
                .IsRequired()
                .HasMaxLength(150);

            // Table & Column Mappings
            this.ToTable("VW_solicitacoes_impressoras");
            this.Property(t => t.imp_codigo).HasColumnName("imp_codigo");
            this.Property(t => t.tip_codigo).HasColumnName("tip_codigo");
            this.Property(t => t.sol_codigo).HasColumnName("sol_codigo");
            this.Property(t => t.tip_descricao).HasColumnName("tip_descricao");
            this.Property(t => t.imp_descricao).HasColumnName("imp_descricao");
            this.Property(t => t.sol_data).HasColumnName("sol_data");
            this.Property(t => t.sol_horario).HasColumnName("sol_horario");
            this.Property(t => t.usu_codigo).HasColumnName("usu_codigo");
            this.Property(t => t.usu_nome).HasColumnName("usu_nome");
            this.Property(t => t.usu_login).HasColumnName("usu_login");
            this.Property(t => t.uni_codigo).HasColumnName("uni_codigo");
            this.Property(t => t.uni_descricao).HasColumnName("uni_descricao");
            this.Property(t => t.car_descricao).HasColumnName("car_descricao");
            this.Property(t => t.set_codigo).HasColumnName("set_codigo");
            this.Property(t => t.set_descricao).HasColumnName("set_descricao");
            this.Property(t => t.imp_numero_serie).HasColumnName("imp_numero_serie");
            this.Property(t => t.sol_descricao).HasColumnName("sol_descricao");
        }
    }
}
